<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}
$v=trim($_GET["v"]);
$shop_id=trim($_GET["sid"]);
$selectlist=array();
if($v<>""){
    if(strpos($v,",")>0){
        $selectlist=explode(",",$v);
    }else{
        $selectlist[]=$v;        
    }
    
}



$page = !($_POST['pageNum'])?'1':intval($_POST['pageNum']);
$pagesize= !($_POST['numPerPage'])?'20':intval($_POST['numPerPage']);


if(empty($pagesize)){
    $pagesize=20;
}
$frmnum=($page-1)*$pagesize;
$orderField=trim($_POST["orderField"]);
$orderDirection=trim($_POST["orderDirection"]);
if(empty($orderField)){
    $orderField="id";
}
if(empty($orderDirection)){
    $orderDirection="desc";
}
if($orderField<>""){
    $order=" order by $orderField ".$orderDirection;
}else{
    $order=" order by listorder desc,id desc";
}

$q=trim($_POST['q']);
$where=' and status>-1';
if(!empty($shop_id)){
    $where.=" and shop_id=".$shop_id."";
}

$total=$ezhand->count("shopping3_goods","`title` like '%$q%'".$where);
$row=$ezhand->select_all("shopping3_goods",'*','`title` like "%'.$q.'%"'.$where.' '.$order.' limit '.$frmnum.','.$pagesize);



?>